//
//  StatusSettingsTitleItem.m
//  Statz
//
//  Created by Dave MacLachlan on 07/08/25.
//
// Copyright 2007 Google Inc.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License.  You may obtain a copy
// of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
// License for the specific language governing permissions and limitations under
// the License.
//

#import "StatusSettingsTitleItem.h"


@implementation StatusSettingsTitleItem
+ (id)statusSettingsTitleItemWithName:(NSString*)name {
  return [[[[self class] alloc] initWithName:name] autorelease];
}

- (id)initWithName:(NSString*)name {
  if ((self = [super init])) {
    name_ = [name retain];
  }
  return self;
}

- (void)dealloc {
  [name_ release];
  [super dealloc];
}

- (NSAttributedString *)name {
  NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys:
                        [NSColor colorWithDeviceWhite:0.0f alpha:0.5f], NSForegroundColorAttributeName,
                        [NSFont boldSystemFontOfSize:11.0f], NSFontAttributeName,
                        nil];
  return [[[NSAttributedString alloc] initWithString:name_
                                          attributes:attr] autorelease];
}


- (NSAttributedString *)displayNameAndStatus {
  return [self name];  
}
- (void)setName:(NSString *)value {
  if (name_ != value) {
    [name_ autorelease];
    name_ = [value copy];
  }
}

- (unsigned int)currentStatusIndex {
  return 0;
}

// Don't cause errors for undefined key value accesses
- (id)valueForUndefinedKey:(NSString *)key {
  return nil; 
}

- (NSString*)description {
  return [NSString stringWithFormat:@"%@ - %@", [super description], [[self name] string]];
}

@end
